/**
	var comboBox_combo = new Ext.ux.form.ComboBox({
		id:'comboBox_comboId',
		data:[['全部',null]],
		width: 75, 
		value:null
	});	
 */
Ext.ns('Ext.ux.form');
Ext.ux.form.ComboBox = Ext.extend(Ext.form.ComboBox, {

    initComponent:function() {
		this.baseParams=this.baseParams||{};
		this.baseParams.is_new_version_ = true; //添加标志位，解决与未封装的老版本兼容问题
		if(!this.url){
			 if(this.isCommonAdapter){
			 	this.baseParams.adapter_id_=this.adapter_id_;
			 	this.url='/customerDetailQueryController.table';
			 }else{
			 	if(typeof(plcdataid)!="undefined"){
			 		this.baseParams.plcdataid=plcdataid;
				 	this.baseParams.plcdatakey=this.key;
				 	this.url='/customerDetailQueryController.table';
			 	}else{
			 		this.url='/combobox.report?decorate=no';
			 	}
			 }
		}
    	if(this.data){ //直接提供数据
    		this.mode="local";
    		this.store = new Ext.data.SimpleStore({
				fields: ['name', 'valtext'],
				data : this.data
			});
    		this.pageSize = null;
    	}else{ //提供表名列名或者key
    		Ext.apply(this.baseParams,{dropdownlist:true,datasourceName:this.dataSource,table:this.table,column:this.column,key:this.key});
    		this.mode="remote";
			this.store = new Ext.data.Store({
				url:getRootPath()+'/'+this.url,
				//autoLoad: {params:{start:0,limit:this.pageSize}},
				baseParams:this.baseParams,
				reader: new Ext.data.JsonReader({   
	                    totalProperty: 'totalCount',    
	                    root: 'data'  
	                },
	                [
	                 	{name: 'name'},{name:'valtext'}
	                ]
	            )
			});
    	}
		Ext.ux.form.ComboBox.superclass.initComponent.apply(this, arguments);
    },
    width:200,
    triggerAction: "all",
    displayField: "name",
    valueField: "valtext",
    editable:false,
    //emptyText : "请选择",
    loadingText : '正在加载信息',
    //typeAhead:true,
    //typeAheadDelay:0,
    minChars:1,
    listeners:{keyup:function(o,e){
    	var code = e.getKey();
    	//按退格键删除到空白时,自动查询
    	if(o.getRawValue().trim()=='' && code==8){
    		o.store.baseParams.query = o.getRawValue();
        	o.store.load();
    	}
    }},
    load:function(){
		this.store.load({params:{start:0,limit:this.pageSize}});
	},
	reload:function(){
		this.store.load();
	},
	getParam:function(p){
		return this.store.baseParams[p];
	},
	setParam:function(p,v){
		this.store.baseParams[p]=v;
	}
});
Ext.reg('xcombo', Ext.ux.form.ComboBox);